﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
 public   class ConvertType
    {
        public static string ToString(object s)
        {
            try
            {
                return s.ToString();
            }
            catch (Exception)
            {

                return "";
            }
        }
        public static int ToInt(object s)
        {
            try
            {
                return int.Parse(s.ToString());
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public static decimal ToDecimal(object s)
        {
            try
            {
                return decimal.Parse(s.ToString());
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public static DateTime ToDate(object s)
        {
            try
            {
                return DateTime.Parse(s.ToString());
            }
            catch (Exception)
            {
                return DateTime.Now;
            }
        }
        public static Boolean ToBool(object s)
        {
            try
            {
                return Convert.ToBoolean(s.ToString());
            }
            catch (Exception)
            {
                return false;
            }
        }

    }
}
